package com.ldc.common.utils;

import android.annotation.SuppressLint;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class TimeUtils {


    public static Calendar getCalendar() {
        return getCalendar(Locale.CHINA);
    }

    public static Calendar getCalendar(Locale locale) {
        return Calendar.getInstance(locale);
    }

    public static Calendar getCalendar(TimeZone zone) {
        return Calendar.getInstance(zone);
    }

    public static String date2String(Date date, String pattern) {
        @SuppressLint("SimpleDateFormat")
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        sdf.setCalendar(getCalendar());
        return sdf.format(date);
    }
}
